﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SharedLib.MessageFramework;

namespace SharedLib.MessageFramework.Messages
{
    public class TaskMessage : AppMessage
    {
        Type _handler;
        private string _customizedID = null;
        public override Type Handler
        {
            get { return _handler; }
        }

        public TaskMessage(object sender, Type handler, IAppMessage parentMessage = null)
            : this(sender, handler, null, null, parentMessage)
        {
        }

        public TaskMessage(object sender, Type handler, object data, IAppMessage parentMessage = null)
            : this(sender, handler, data, null, parentMessage)
        {
        }

        public TaskMessage(object sender, Type handler, object data, string customizedID, IAppMessage parentMessage = null)
            : base(sender, data, parentMessage)
        {
            _handler = handler;
            _customizedID = customizedID;
        }

        

        public override string HandlerUID
        {
            get
            {
                if (_customizedID != null) return _customizedID;
                return base.HandlerUID;
            }
        }
    }
}
